package com.ruoyi.pidaijiData.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.pidaijiData.domain.plat.DataPidaijiNh;
import com.ruoyi.pidaijiData.mapper.DataPidaijiNhMapper;
import com.ruoyi.pidaijiData.service.IDataPidaijiNhService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.Future;


/**
 * 皮带机能耗测试数据Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-04
 */
@Service
public class DataPidaijiNhServiceImpl implements IDataPidaijiNhService
{
    @Autowired
    private DataPidaijiNhMapper dataPidaijiNhMapper;

    /**
     * 查询皮带机能耗测试数据
     * 
     * @param nhId 皮带机能耗测试数据主键
     * @return 皮带机能耗测试数据
     */
    @Override
    public DataPidaijiNh selectDataPidaijiNhByNhId(Long nhId)
    {
        return dataPidaijiNhMapper.selectDataPidaijiNhByNhId(nhId);
    }

    /**
     * 查询皮带机能耗测试数据列表
     * 
     * @param dataPidaijiNh 皮带机能耗测试数据
     * @return 皮带机能耗测试数据
     */
    @Override
    public List<DataPidaijiNh> selectDataPidaijiNhList(DataPidaijiNh dataPidaijiNh)
    {
        return dataPidaijiNhMapper.selectDataPidaijiNhList(dataPidaijiNh);
    }

    /**
     * 查询皮带机能耗测试数据
     *
     * @param dataTaskId
     * @return 皮带机能耗测试数据
     */
    @Async("threadPoolKy")
    @Override
    public Future<List<DataPidaijiNh>> selectDataPidaijiNhByDataTaskId(Long dataTaskId) {
        return new AsyncResult<>(dataPidaijiNhMapper.selectDataPidaijiNhByDataTaskId(dataTaskId));
    }

    /**
     * 新增皮带机能耗测试数据
     *
     * @param dataPidaijiNhs 皮带机能耗测试数据
     * @return 结果
     */
    @Override
    public int batchDataPidaijiNh(List<DataPidaijiNh> dataPidaijiNhs) {
        return dataPidaijiNhMapper.batchDataPidaijiNh(dataPidaijiNhs);
    }

    /**
     * 修改皮带机能耗测试数据
     *
     * @param dataTaskId
     * @return 结果
     */
    @Override
    public int updateDataPidaijiNhByDataTaskId(Long dataTaskId) {
        return dataPidaijiNhMapper.updateDataPidaijiNhByDataTaskId(dataTaskId);
    }

    /**
     * 修改皮带机能耗测试数据
     *
     * @param nhId
     * @return 结果
     */
    @Override
    public int updateDataPidaijiNhByNhId(Long nhId) {
        return dataPidaijiNhMapper.updateDataPidaijiNhByNhId(nhId);
    }

    /**
     * 新增皮带机能耗测试数据
     * 
     * @param dataPidaijiNh 皮带机能耗测试数据
     * @return 结果
     */
    @Override
    public int insertDataPidaijiNh(DataPidaijiNh dataPidaijiNh)
    {
        dataPidaijiNh.setCreateTime(DateUtils.getNowDate());
        return dataPidaijiNhMapper.insertDataPidaijiNh(dataPidaijiNh);
    }

    /**
     * 修改皮带机能耗测试数据
     * 
     * @param dataPidaijiNh 皮带机能耗测试数据
     * @return 结果
     */
    @Override
    public int updateDataPidaijiNh(DataPidaijiNh dataPidaijiNh)
    {
        dataPidaijiNh.setUpdateTime(DateUtils.getNowDate());
        return dataPidaijiNhMapper.updateDataPidaijiNh(dataPidaijiNh);
    }

    /**
     * 批量删除皮带机能耗测试数据
     * 
     * @param nhIds 需要删除的皮带机能耗测试数据主键
     * @return 结果
     */
    @Override
    public int deleteDataPidaijiNhByNhIds(Long[] nhIds)
    {
        return dataPidaijiNhMapper.deleteDataPidaijiNhByNhIds(nhIds);
    }

    /**
     * 删除皮带机能耗测试数据信息
     * 
     * @param nhId 皮带机能耗测试数据主键
     * @return 结果
     */
    @Override
    public int deleteDataPidaijiNhByNhId(Long nhId)
    {
        return dataPidaijiNhMapper.deleteDataPidaijiNhByNhId(nhId);
    }
}
